
public class FileFusion {

    public static void main(String[] args) {
        int[] a = new int[50];
        int[] b = new int[40];
        int[] c = new int[30];

        for(int i = 0; i < 50; i++) {
            a[i] = i;
        }
        for(int i = 0; i < 40; i++) {
            b[i] = 39 - i;
        }
        for(int i = 0; i < 30; i++) {
            c[i] = 2 * i;
        }


        Fusion.initialize(3, 2);
        //Fusion.initialize(3, 1);

        int[][] code = new int[50][2];
        //int[][] code = new int[50][1];

        for(int i = 0; i < 50; i++) {
            code[i][0] = 0;
            code[i][1] = 0;

            try {
                code[i] = Fusion.getUpdatedCodeWords(code[i], 0, a[i], 0);
                //code[i][0] = Fusion.getUpdatedCode(code[i][0], 0, 0, a[i], 0);
                //code[i][1] = Fusion.getUpdatedCode(code[i][1], 1, 0, a[i], 0);
            }
            catch(InterfaceException e) {
            }
        }
        for(int i = 0; i < 40; i++) {
            try {
                code[i] = Fusion.getUpdatedCodeWords(code[i], 0, b[i], 1);
                //code[i][0] = Fusion.getUpdatedCode(code[i][0], 0, 0, b[i], 1);
                //code[i][1] = Fusion.getUpdatedCode(code[i][1], 1, 0, b[i], 1);
            }
            catch(InterfaceException e) {
            }
        }
        for(int i = 0; i < 30; i++) {
            try {
                code[i] = Fusion.getUpdatedCodeWords(code[i], 0, c[i], 2);
                //code[i][0] = Fusion.getUpdatedCode(code[i][0], 0, 0, c[i], 2);
                //code[i][1] = Fusion.getUpdatedCode(code[i][1], 1, 0, c[i], 2);
            }
            catch(InterfaceException e) {
            }
        }
        int[] erasuresArray = new int[3];
        erasuresArray[0] = 0;
        erasuresArray[1] = 1;
        erasuresArray[2] = -1;

        int[] data = null;
        int[] dataword = new int[3];
        int[] tmpCode = new int[2];
        //int[] tmpCode = new int[1];
       
        for(int i = 0; i < 50; i++) {
            dataword[0] = 0;//a[i]; 
            dataword[1] = 0;//(i < b.length) ? b[i] : 0;
            dataword[2] = (i < c.length) ? c[i] : 0;
            tmpCode[0] = code[i][0]; 
            tmpCode[1] = code[i][1]; 
            try {
                data = Fusion.getRecoveredData(tmpCode, dataword, erasuresArray);
            }
            catch(InterfaceException e) {
            }
            System.out.println("a[" + i + "]: " + data[0] + ", b[" + i + "]: " + data[1] + ", c[" + i + "]: " + data[2]);
        }
    }
}
